package com.redoor.app.stake.basicdata.hsf.service.utils;

import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import sunbox.core.hsf.api.StakeService;
import sunbox.core.vo.api.OpenAPIResponse;

import java.util.List;
import java.util.Map;

@Component
public class CommonUtil {
    private Logger logger = LoggerFactory.getLogger(CommonUtil.class);

    @Autowired
    private StakeService stakeService;

    public boolean sendBindToKeDong(List<Map<String, String>> list, String prOrgCode){
        if (list.size()==0){
            logger.info("桩计费模型失败，桩上没有计费模型") ;
            return false ;
        }
        String orgCode = prOrgCode;
        OpenAPIResponse resp = stakeService.acceptModelStakeRel("", orgCode, JSON.toJSONString(list)) ;

        return resp.getCode() == 0 ;
    }
}
